WindwardReports Utility Reference
The WindwardReports.jar file that is part of the Java Report Engine installation includes some useful utilities.
CheckJdbc
net.windward.tools.CheckJdbc checks what JDBC parameters to use when connecting to a database. Parameters are:
- jdbc_classpath - the classpath for the JDBC driver. Examples are:
- SQL Server: com.microsoft.jdbc.sqlserver.SQLServerDriver
- Oracle: oracle.jdbc.driver.OracleDriver
- database_name - the connection string used to connect to a specific database. Examples are:
- SQL Server: com.microsoft.jdbc.sqlserver.SQLServerDriver
- Oracle: jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=database_name
- username [optional] - The username used when connecting to the database
- password [optional] - The password used when connecting to the database
JoinReports
JoinReports.joinPdf() combines output from multiple Report Templates into a single PDF document.
This operates differently from importing multiple templates into a master DOCX or XLSX template.
When you use the Import Tag, the imported template is converted into an element in the master template. For example, importing an XLSX file into a DOCX file converts the worksheets into Word tables. A Word table does not have the concept of hidden rows/columns, etc. and so that meta information is lost.
JoinReports keeps each document in its native template format. Each is then output to PDF and the PDF pages are then joined together in a single PDF document. This way you can combine DOCX and XLSX templates and both render their PDF pages as they would directly.
The API is passed an array of ProcessReport objects (and an OutputStream for the generated PDF report). If you are combining a number of static documents this is overkill and requires a couple of additional lines of code. However, if you want to build up distinct reports, applying data to templates, then combine those generated reports, this supports that use case.
ListServers
net.windward.tools.ListServers (no parameters) will list out all Fluent servers running on the network listing their version number, IP address, and server name (repeating the IP address if it has no name).
OutTagFormat
net.windward.tools.OutTagFormat is a quick way to find what format a <wr:out …/>
tag will generate for a given string, type and pattern attributes. It also displays the output generated both by Fluent Reports and the underlying Java classes. Both are displayed because some Java implementations differ in their formatted output, and this is something Fluent Reports cannot control.
RunReport
Generate output from a Report Template. This is a sample program that generates output from the command line. An example is:
java net.windward.xmlreport.RunReport InternetMarketingReport.docx testreport.pdf -xml:INTMARKETING InternetMarketingData.xml
Usage:
RunReport template_file output_file [-basedir path] [-xml xml_file | -sql connection_string | -oracle connection_string | -ole oledb_connection_string] [licenseKey=value | ...]
The template file can be a docx, pptx, or xlsx file.
The output file extension determines the report type created:
output.csv - SpreadSheet CSV file
output.docx - Word 2007+ DOCX file
output.htm - HTML file with no CSS
output.html - HTML file with CSS
output.pdf - Acrobat PDF file
output.pptx - PowerPoint 2007+ PPTX file
output.prn - Printer where "output" is the printer name
output.rtf - Rich Text Format file
output.txt - Ascii text file
output.xhtml - XHTML file with CSS
output.xlsx - Excel 2007+ XLSX file
output.xlsm - Excel 2007+ macro enabled XLSM file
-basedir c:\test - sets the datasource base directory to the specified folder (c:\test in this example)
-data filename.xml - will write data.xml to this filename.
-embed - will embed data.xml in the generated report. DOCX, PDF, PPTX, & XLSX only.
-launch - will launch the report when complete.
-performance:123 - will run the report 123 times.
output file is used for directory and extension for reports
-cache - will cache template & datasources, will write output to memory stream. Only used with -performance
-threads:4 - will create 4 threads when running -performance.
-verify:N - turn on the error handling and verify feature where N is a number: 0 (none) , 1 (track errors), 2 (verify), 3 (all). The list of issues is printed to the standard error.
-version=9 - sets the template to the passed version (9 in this example)
encoding=UTF-8 (or other) - set BEFORE datasource to specify an encoding
locale=en_US - set the locale passed to the engine.
pod=pod_filename - set a POD file (datasets)
username=user password=pass - set BEFORE datasource for database connections
The datasource is identified with a pair of parameters
-cache connection_string - ex: //SERVER:PORT/DbName
-db2 connection_string - ex: //localhost:50000/SAMPLE
-excel connection_string - ex: Driver={Microsoft Excel Driver (*.xls)};DBQ=c:\testData.xls
-oracle connection_string - ex: @//localhost:1521/ORCL
-mysql connection_string - ex: //localhost/sakila
-sql connection_string - ex: //localhost:1433;DatabaseName=Northwind
-postgresql connection_string - ex: //localhost/pagila
-json filename - passes a JSON file as the datasource
filename can be a url/filename or a connection string
-odata url - passes a url as the datasource accessing it using the OData protocol
-sforce - password should be password+securitytoken
-xml filename - passes an xml file as the datasource
-xml xmlFilename=schema:schemaFilename - passes an xml file and a schema file as the datasource
filename can be a filename or a connection string
-dom4j filename - passes an xml file as the datasource. Uses XPath 1.0 (dom4J)
-dom4j xmlFilename=schema:schemaFilename - passes an xml file and a schema file as the datasource
filename can be a filename or a connection string
-[xml|sql|...]:name names this datasource with name
must come BEFORE each -xml, -sql, ... part
You can have 0-N key=value pairs that are passed to the datasource Map property
If the value starts with I', F', or D' it parses it as an integer, float, or date(yyyy-MM-ddThh:mm:ss)
example date="D'1996-08-29"
If the value is * it will set a filter of all
If the value is \"text,text,...\" it will set a filter of all
ShowFonts
net.windward.tools.ShowFonts will display all fonts Java is aware of on your system. Run this and if it throws an exception, then there is a bug in the Java font layout code and there is no way Fluent can do a work around. The source code to this class is in WindwardReports.jar.
This class makes no calls to Windward. If this program cannot run, then it is a Java bug, not a Fluent bug
UUEncode
net.windward.util.UUEncode will uuencode a file. This is useful for uuencoding bitmap files that will be placed directly in an XML file. To create a uuencoded file, run the program as “java net.windward.util.UUEncode image.jpg image.uue”
- image.jpg - the binary file to uuencode.
- image.uue - the created file that is a uuencode of the binary file.
XMLPerf
net.windward.tools.XmlPerf will read in an XML file and evaluate an XPath search. It lists the time and memory footprint both before and after to give a measure of how fast dom4j can handle files of a given size and complexity.